package com.framework.service.yhbservice.impl;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.framework.dao.YHBDao.indexDao.YhbServiceMenuDao;
import com.framework.service.yhbservice.YhbServiceMenuSerivce;
import com.framework.service.yhbservice.YhbUserService;
import com.framework.yhbEntity.Index.YhbServiceMenu;
import com.framework.yhbEntity.user.YhbUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
@Transactional(rollbackFor = Exception.class)
@Service("yhbServiceMenuSerivce")
public class YhbServiceMenuSerivceImpl extends ServiceImpl<YhbServiceMenuDao,YhbServiceMenu> implements YhbServiceMenuSerivce {

    @Autowired
    private YhbUserService yhbUserService;

    @Override
    public List<YhbServiceMenu> getServiceMenu(String token) {
        YhbUser user = yhbUserService.queryUserByToken(token);
        List<YhbServiceMenu> list = baseMapper.selectList(new EntityWrapper<YhbServiceMenu>()
                .eq("dept_id", user.getDeptId()).eq("is_show",1)

        );
        return list;
    }
}